package com.s4j.core.manager.action;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.Action;
import com.s4j.core.manager.model.SysButton;
import com.s4j.core.manager.service.MenuButtonService;

@Controller("com.s4j.core.manager.action.MenuButtonAction")
@Scope("prototype")
public class MenuButtonAction {

	private Long menuId;
	
	private List<SysButton> menuButtons;
	
	@Resource
	private MenuButtonService menuButtonService;
	
	public String createMenuButton() {
		
		if(menuId != null) {
			menuButtons = menuButtonService.createMenuButton(menuId);
		}
		
		return Action.SUCCESS;
	}

	public void setMenuId(Long menuId) {
		this.menuId = menuId;
	}

	public List<SysButton> getMenuButtons() {
		return menuButtons;
	}

	public void setMenuButtons(List<SysButton> menuButtons) {
		this.menuButtons = menuButtons;
	}
}
